package com.zj.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.NotEmpty;
import java.util.Date;


public class Apple {
    private  Integer id;
    @NotEmpty
    private String region;

    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss",locale = "zh")

    private Date produceDate;
    private float weight;

    public Apple(Integer id, String region, float weight,Date date) {
        this.id = id;
        this.region = region;
        this.weight = weight;
        this.produceDate= date;
    }

    public Apple(String region, float weight,Date date) {
        this.region = region;
        this.weight = weight;
        this.produceDate= date;
    }

    public Apple(){}

    /**
     * 若get返回为int，不是Integer，则postForEntity的json转化异常HttpMessageNotWritableException
     *
     */
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public Date getProduceDate() {
        return produceDate;
    }

    public void setProduceDate(Date produceDate) {
        this.produceDate = produceDate;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Apple{" +
                "id=" + id +
                ", region='" + region + '\'' +
                ", weight=" + weight +
                '}';
    }
}
